@echo off

setlocal

REM 设置项目名称和主入口文件路径
set APP_NAME=SM4ZServer
set MAIN_PKG=./main.go

REM Windows amd64 (64-bit)
set GOOS=windows
set GOARCH=amd64
go build -ldflags="-s -w" -o "%APP_NAME%-windows-%GOARCH%.exe" %MAIN_PKG%

REM Windows 386 (32-bit)
set GOOS=windows
set GOARCH=386
go build -ldflags="-s -w" -o "%APP_NAME%-windows-%GOARCH%.exe" %MAIN_PKG%

REM Linux amd64 (64-bit), 注意在Windows上交叉编译Linux程序可能需要MinGW-w64环境
set GOOS=linux
set GOARCH=amd64
go build -ldflags="-s -w" -o "%APP_NAME%-linux-%GOARCH%" %MAIN_PKG%

echo 打包完成，生成的可执行文件位于当前目录：
dir /b %APP_NAME%-*-*.exe %APP_NAME%-linux-%GOARCH%